<template>
  <div>
    <div ref="pieEchart" class="echartBox" />
  </div>
</template>

<script>
import * as echarts from 'echarts/core'
import { PieChart } from 'echarts/charts'
import { CanvasRenderer } from 'echarts/renderers'
import { TooltipComponent, LegendComponent } from 'echarts/components'
import { LabelLayout } from 'echarts/features'

echarts.use([
  TooltipComponent,
  LegendComponent,
  PieChart,
  CanvasRenderer,
  LabelLayout
])
export default {
  created() {

  },
  mounted() {
    const pieEchart = echarts.init(this.$refs.pieEchart)
    pieEchart.setOption({
      tooltip: {
        trigger: 'item'
      },
      legend: {
        top: '5%',
        left: 'center'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: ['40%', '70%'],
          avoidLabelOverlap: false,
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '40',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            { value: 580, name: '公寓' },
            { value: 484, name: '别墅' },
            { value: 300, name: '商铺' }
          ]
        }
      ]
    })
  }
}
</script>

<style>
.echartBox {
  height: 400px;
}
</style>
